#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<assert.h>
#include<stdlib.h>
#include<stdbool.h>

typedef char QueDateType;

typedef struct SList {
    struct SList* next;
    QueDateType date;
}SL;

typedef struct Queue {
    SL* head;
    SL* tail;
    int size;
}Queue;

void QueInit(Queue* p)
{
    assert(p);
    p->head = p->tail = NULL;
    p->size = 0;
}

void QuePush(Queue* p, QueDateType x)
{
    assert(p);
    SL* newnode = (SL*)malloc(sizeof(SL));
    if (newnode == NULL)
    {
        perror("QuePush:malloc");
        return;
    }
    newnode->date = x;
    newnode->next = NULL;
    if (p->size == 0)
    {
        p->head = p->tail = newnode;
    }
    else
    {
        p->tail->next = newnode;
        p->tail = newnode;
    }
    p->size++;
}

void QuePop(Queue* p)
{
    assert(p);
    assert(p->head != NULL);
    SL* next = p->head->next;
    free(p->head);
    p->head = NULL;
    p->head = next;
    p->size--;
}

bool QueJuS(Queue* p)
{
    assert(p);
    return p->size == 0;
}

QueDateType QueTop(Queue* p)
{
    assert(p);
    assert(!QueJuS(p));
    return p->head->date;
}

int QueSize(Queue* p)
{
    assert(p);
    return p->size;
}

void QueDestroy(Queue* p)
{
    assert(p);
    SL* cur = p->head;
    while (cur)
    {
        SL* next = cur->next;
        free(cur);
        cur = next;
    }
    p->size = 0;
}

QueDateType QueBack(Queue* p)
{
    assert(p);
    return p->tail->date;
}

SL* CheckSame(Queue* p, QueDateType x)
{
    SL* cur = p->head;
    while (cur->next)
    {
        if (cur->date == x)
        {
            return cur;
        }
        else {
            cur = cur->next;
        }
    }
    return NULL;
}

void FindDs(Queue* p, SL* q)
{
    assert(p);
    SL* cur = p->head;
    while (cur->date != q->date)
    {
        cur = cur->next;
    }
    while (cur)
    {
        SL* next = cur->next;
        free(cur);
        cur = next;
        p->size--;
    }
}

int main()
{
    Queue A, B, S;
    QueInit(&A);
    QueInit(&B);
    QueInit(&S);
    int val;
    while ((val = getchar()) != EOF && val != '\n')
    {
        QuePush(&A, (char)val);
    }
    while ((val = getchar()) != EOF && val != '\n')
    {
        QuePush(&B, (char)val);
    }
    int k = 1;
    while (!(QueJuS(&A)) && !(QueJuS(&B)))
    {
        if (k % 2 == 1)
        {
            QuePush(&S, QueTop(&A));
            QuePop(&A);
            SL* tmp = CheckSame(&S, QueBack(&S));
            if (tmp != NULL)
            {
                SL* cur = tmp;
                while (cur)
                {
                    QuePush(&A, cur->date);
                    cur = cur->next;
                }
                FindDs(&S, tmp);
            }
            else
            {
                k++;
            }
        }

        if (k % 2 == 0)
        {
            QuePush(&S, QueTop(&B));
            QuePop(&B);
            SL* tmp = CheckSame(&S, QueBack(&S));
            if (tmp != NULL)
            {
                SL* cur = tmp;
                while (cur)
                {
                    QuePush(&B, cur->date);
                    cur = cur->next;
                }
                FindDs(&S, tmp);
            }
            else
            {
                k++;
            }
        }
    }
    if (A.size == 0)
    {
        SL* cur = B.head;
        while (cur)
        {
            printf("%c", cur->date);
            cur = cur->next;
        }
    }
    else
    {
        SL* cur = A.head;
        while (cur)
        {
            printf("%c", cur->date);
            cur = cur->next;
        }
    }
    return 0;
}
